package com.zzty.train.entity;

import  com.alibaba.fastjson.JSONObject;
import  org.apache.commons.lang.StringUtils;

public class User {
    private Integer id;
    private String name;
    private String password;
    private Integer type;
    private String email;
    private String img;
    private Integer clazzId;
    private String openid;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public Integer getClazzId() {
        return clazzId;
    }

    public void setClazzId(Integer clazzId) {
        this.clazzId = clazzId;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", type=" + type +
                ", email='" + email + '\'' +
                ", img='" + img + '\'' +
                ", clazzId=" + clazzId +
                ", openid='" + openid + '\'' +
                '}';
    }


    public String toJsonString(){
        JSONObject user = new JSONObject();
        if (!StringUtils.isEmpty(this.name)) {
            user.put("name",this.name);
        }
        if(this.id!=null){
            user.put("id",this.id);
        }
        if(this.password!=null){
            user.put("password",this.password);
        }
        if(this.type!=null){
            user.put("type",this.type);
        }
        if(this.email!=null){
            user.put("email",this.email);
        }
        if(this.img!=null){
            user.put("img",this.img);
        }
        if(this.clazzId!=null){
            user.put("clazzId",this.clazzId);
        }
        if(this.openid!=null){
            user.put("openid",this.openid);
        }

        return user.toString();
        }



}
